package com.breakfast.fun.data.entity.mall;

import com.breakfast.fun.data.entity.home.CenterAd;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yukai on 2016/10/31.
 */

public class MallBanner implements Serializable {

    /**
     * total : 0
     * pageTotal : 0
     * data : {"banner":[{"id":70,"cityId":1,"title":"测试商城banner","picture":"http://m.52letsgo.cn/ad_img/2/9/86dcf530-f_-1721347402.jpg","sort":1,"info":"测试商城banner","linkUrl":"","linkId":0,"positionLable":"shopad","typeLable":"ad","state":0,"addTime":"2016-10-21 15:45:19"},{"id":72,"cityId":1,"title":"测试2","picture":"http://m.52letsgo.cn/ad_img/15/10/4ff533d6-6_441268684.jpg","sort":1,"info":"测试2","linkUrl":"","linkId":0,"positionLable":"shopad","typeLable":"ad","state":0,"addTime":"2016-10-28 10:16:16"}]}
     * msg : 查询成功
     * success : true
     */

    private int total;
    private int pageTotal;
    private DataBean data;
    private String msg;
    private boolean success;

    public static MallBanner objectFromData(String str) {

        return new Gson().fromJson(str, MallBanner.class);
    }

    public static List<MallBanner> arrayMallBannerFromData(String str) {

        Type listType = new TypeToken<ArrayList<MallBanner>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public static class DataBean implements Serializable {
        /**
         * id : 70
         * cityId : 1
         * title : 测试商城banner
         * picture : http://m.52letsgo.cn/ad_img/2/9/86dcf530-f_-1721347402.jpg
         * sort : 1
         * info : 测试商城banner
         * linkUrl :
         * linkId : 0
         * positionLable : shopad
         * typeLable : ad
         * state : 0
         * addTime : 2016-10-21 15:45:19
         */

        private List<CenterAd> banner;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public List<CenterAd> getBanner() {
            return banner;
        }

        public void setBanner(List<CenterAd> banner) {
            this.banner = banner;
        }

    }
}
